<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
   <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="chenxing-technology">
    <meta name="keyword" content="">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/resources/img/favicon.ico">
    <title>樱桃管理-商户录入</title>
    <!-- Bootstrap CSS -->    
    <link href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" rel="stylesheet">
    <!-- bootstrap theme -->
    <link href="<%=request.getContextPath()%>/resources/css/bootstrap-theme.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/resources/css/style.css" rel="stylesheet">
    <script src="<%=request.getContextPath()%>/resources/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="<%=request.getContextPath()%>/resources/dist/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="<%=request.getContextPath()%>/resources/dist/localization/messages_zh.js" type="text/javascript" charset="utf-8"></script>
     
  </head>

  <body>
  <!-- container section start -->
  <section id="container" class="">
         
     <jsp:include page="heads.jsp" />

      <!--sidebar start-->
      <aside>
          <div id="sidebar"  class="nav-collapse ">
              <!-- sidebar menu start-->
              <ul class="sidebar-menu">                
                  <li class="sub-menu">
                      <a href="javascript:;" class="">
                          <span>单据信息</span>
                          <span class="menu-arrow"></span>
                      </a>
                      <ul name="sub" class="sub">
                          <li><a class="" href="${ctx }/summary/summaryAdd">单据录入</a></li>                          
                          <li><a class="" href="${ctx }/summary/selectSum?pageNow=1">单据录入汇总</a></li>
                          <li><a class="" href="${ctx }/getTable/addGet">单据领取</a></li>
                          <li><a class="" href="${ctx }/getTable/showGet?pageNow=1">单据领取汇总</a></li>
                      </ul>
                  </li> 
				          <li class="sub-menu open">
                      <a href="javascript:;" class="">
                          <span>商户录入</span>
                          <span class="menu-arrow"></span>
                      </a>
                      <ul name="sub" class="sub">
                          <li><a class="" href="${ctx }/meentry/addMeJsp">商户录入</a></li>                          
                          <li><a class="" href="${ctx }/meentry/showMeenAll?pageNow=1">商户录入汇总</a></li>
                          <li><a class="" href="${ctx }/meentry/orderlist">订单信息</a></li>
                      </ul>
                  </li>       
                  <li class="sub-menu">
                      <a href="${ctx }/meentry/farmerJsp" class="">
                          <span>农户录入</span>
                          <span class="menu-arrow"></span>
                      </a>
                  </li>
                  <li class="sub-menu">
                      <a class="" href="${ctx }/meentry/settlement">
                          <span>结算信息</span>
                          <span class="menu-arrow"></span>
                      </a>
                  </li>
                 
              </ul>
               <div class="add-button text-center">
              	<a href="${ctx }/user/addUserJsp">添加账号</a>
              </div>
              <!-- sidebar menu end-->
          </div>
      </aside>
      <!--sidebar end-->
      
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper summary-table">            
              <!--overview start-->
			        <section class="panel summary-header">
			        	<div class="row">			        		
			        		<div class="col-sm-8">			        			   
                      <form action="${ctx }/meentry/showMeByVolume" id="commentForm" method="post">
                      	<label for="">册号：</label>
                      	<input type="number" name="mvolume" id="mvolume" min="1" digits="true" placeholder="请输入册号"/>
                      	<input type="submit" value="搜索" class="search-button"/>
                      </form>
                   </div>
                   <div class="col-sm-4 text-right">			        			   
                        <a class="btn btn-primary half-work">草稿箱</a>      
                   </div>                 
			        	</div>			        	
			        </section>
			        <section class="panel">
			        	<table class="table table-bordered text-center">
                              <thead>
                              <tr>
                                  <th>册号</th>
                                  <th>商品名</th>
                                  <th>单据号</th>
                                  <th>品种</th>
                                  <th>重量(kg)</th>
                                  <th>单价(元)</th>
                                  <th>手续费(元)</th>
                                  <th>总金额(元)</th>
                                  <th>结算状态</th>
                                  <th>作废</th>
                                  <th>备注</th>
                              </tr>
                              </thead>
                              <tbody id="shlr">
                              	<c:forEach var="me" items="${meList }" varStatus="vs">
	                              <tr style="height: 45px;">
	                                  <td>${me.mvolume }</td>
	                                  <td><div class="beizhu">${me.msogoname }</div></td>
	                                  <td>${me.mdocumentnum }</td>
	                                  <td><div class="beizhu">樱桃</div></td>
	                                  <td><input type="number" name="weight" id="weight${vs.index }" min="0.0" step="0.1" placeholder="请输入重量" onmouseout="js(${vs.index })"/></td>
	                                  <td><input type="number" name="price" id="price${vs.index }" min="0.0" step="0.1" placeholder="请输入单价" onmouseout="js(${vs.index })"/></td>
	                                  <td><span id="service-charge${vs.index }">0</span></td>
	                                  <td><span id="total-money${vs.index }">0</span></td>
	                                  <td>结算中...</td>
	                                  <td><button id="cancellation${vs.index }" onclick="zf(${vs.index })">作废</button></td>
	                                  <td><div class="beizhu">这一个项目中的这一个项目中的这一个项目中的</div></td>
	                              </tr>
                              	</c:forEach>
                              </tbody>
                          </table>
                                                      
                              <div class="form-group">
                                 <div class="col-lg-12 text-center">
                        	          <button class="btn btn-default" type="button" onClick="history.back()">取消</button>
                                    <button class="btn btn-primary" type="submit">确定</button> 
                                    <button class="btn btn-primary" type="submit">存为草稿</button>
                                 </div>
                              </div>                             
                          
			        </section>
          </section>
      <!--main content end-->
     </section>
     <script type="text/javascript">
     $(function() {
     var menu = $(".sidebar-menu .sub-menu")
     menu.click(function() {
         i = $(this).index();
         $(this).addClass("open").siblings().removeClass("open");
         $(this).children(".sub").addClass("current");
         $(this).siblings().children(".sub").removeClass("current");
     })
     })
     /* 计算手续费以及总金额  */
     function js(index){
     	var w = $("#weight"+index).attr("value");
     	var p = $("#price"+index).attr("value");
     	var sxfcs = 0.05;
     	var sxf = w*p*sxfcs;
     	var sum = sxf+w*p;
     	if((w!="")&&(p!="")){
	     	$("#service-charge"+index).text(sxf.toFixed(2));
	     	$("#total-money"+index).text(sum.toFixed(2));
     	}
     }
     /* 作废按钮的处理  */
     function zf(index){
     	$("#weight"+index).attr("value",null);
     	$("#price"+index).attr("value",null);
     	$("#service-charge"+index).text(0);
     	$("#total-money"+index).text(0);
     }
     /* 表单验证 */
	$().ready(function() {
	    $("#commentForm").validate();
	});
     </script>
  </body>
</html>
